package by.koleda.photoupdater.fragment;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import by.koleda.photoupdater.R;
import by.koleda.photoupdater.VkLoginActivity;

public class LoginDialogFragment extends DialogFragment {

	@Override
	public Dialog onCreateDialog(Bundle savedInstanceState) {
		AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
		builder.setTitle(R.string.login_title)
			   .setItems(R.array.login_array, new DialogInterface.OnClickListener() {
				
				@Override
				public void onClick(DialogInterface dialog, int which) {
					dialog.dismiss();
					if (which == 0) {
						Intent intent = new Intent(getActivity(), VkLoginActivity.class);
						getActivity().startActivityForResult(intent, 5);
					}
				}
			});
		return builder.create();
				
	}
	
	

}
